import pandas as pd
from pandas import Series,DataFrame
from operator import attrgetter
class Person:
    def __init__(self,name,age):
        self.name=name
        self.age=age


if __name__=="__main__":
    person= Person("123",12)
    print(attrgetter("name")(person))  


#第一个参数data,第二个参数试自定义索引，不指定为1，2...n顺序
#seriesEg=Series([1,2,1],index=['a','b','c'])
# a    1
# b    2
# c    3
# dtype: int64
seriesEg=Series([1,2,1],['a','b','c'])
print(seriesEg) 
print(seriesEg['a'])


#DataFrame包括行索引和列索引，类似数据库结构的一种


dataFrameEg=DataFrame({"languageScore":[60,30,65],"mathScore":[93,96,92],"englishScore":[90,77,88]},index=["张飞","关羽","黄忠"])
print(dataFrameEg)
print(dataFrameEg["languageScore"])

#     languageScore  mathScore  englishScore
# 张飞             60         93            90
# 关羽             30         96            77
# 黄忠             65         92            88

# 张飞    60
# 关羽    30
# 黄忠    65

